#ifndef NPROPLIST_H_
#define NPROPLIST_H_

#include<QAbstractListModel>
#include "../../../../nemosomen/DataModel/src/nemosomenBase.h"
#include "../../include/dto/camData.h"

class NPropTextList : public QAbstractListModel
{
	Q_OBJECT
public:
	NPropTextList(NProp<TextData*> *_prop,QObject *parent=0):
		QAbstractListModel(parent) {
		prop=_prop;
	}
	virtual ~NPropTextList(){}
	int rowCount(const QModelIndex &parent = QModelIndex()) const {
		return prop->size();
	}
	QVariant data(const QModelIndex &index,int role) const {
		if (!index.isValid()) {
				return QVariant();
			}
			if (index.row()>= prop->size()) {
				return QVariant();
			}
			if (role==Qt::DisplayRole) {
				TextData *data = prop->get(index.row());
				return QVariant(data->text->get().data());
			}
			else
				return QVariant();
	}
private:
	NProp<TextData*> *prop;
};

class NPropMovieList : public QAbstractListModel
{
	Q_OBJECT
public:
	NPropMovieList(NProp<MovieData*> *_prop,QObject *parent=0):
		QAbstractListModel(parent) {
		prop=_prop;
	}
	virtual ~NPropMovieList(){}
	int rowCount(const QModelIndex &parent = QModelIndex()) const {
		return prop->size();
	}
	QVariant data(const QModelIndex &index,int role) const {
		if (!index.isValid()) {
				return QVariant();
			}
			if (index.row()>= prop->size()) {
				return QVariant();
			}
			if (role==Qt::DisplayRole) {
				MovieData *data = prop->get(index.row());
				return QVariant(data->name->get().data());
			}
			else
				return QVariant();
	}
private:
	NProp<MovieData*> *prop;
};

class NPropList : public QAbstractListModel
{
	Q_OBJECT
public:
	NPropList(NProp<CamData*> *_prop,QObject *parent=0):
		QAbstractListModel(parent) {
		prop=_prop;
	}
	virtual ~NPropList(){}
	int rowCount(const QModelIndex &parent = QModelIndex()) const {
		return prop->size();
	}
	QVariant data(const QModelIndex &index,int role) const {
		if (!index.isValid()) {
				return QVariant();
			}
			if (index.row()>= prop->size()) {
				return QVariant();
			}
			if (role==Qt::DisplayRole) {
				CamData *data = prop->get(index.row());
				return QVariant(data->getName().data());
			}
			else
				return QVariant();
	}
private:
	NProp<CamData*> *prop;
};

#endif /*NPROPLIST_H_*/

